import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home.vue'
import Layout from '@/views/layout.vue'
// const Find = () => import('@/views/find.vue')
// const News = () => import('@/views/news.vue')
// const User = () => import('@/views/user.vue')
// const City = () => import('@/views/city.vue')
import Find from '@/views/find.vue'
import News from '@/views/news.vue'
import User from '@/views/user.vue'
import City from '@/views/city.vue'

Vue.use(VueRouter)
// 懒加载
const routes = [
  { path: '/city', component: City },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      { path: '/home', component: Home },
      { path: '/find', component: Find },
      { path: '/news', component: News },
      { path: '/user', component: User }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
